#pragma once


// CMessageListCtrl

#define ML_GROUPBY_NONE 0
#define ML_GROUPBY_TITLE 1
#define ML_GROUPBY_AUTHOR 2
#define ML_GROUPBY_TIME 3



class CMessageListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(CMessageListCtrl)

public:
	CMessageListCtrl();
	virtual ~CMessageListCtrl();

	int m_iGroupMode;
	BOOL m_bShowUnreadOnly;


protected:
	static int CALLBACK CompareLvItem(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	System::Guid currentFolderGuid;
	System::Guid currentMessageGuid;
	gcroot<System::Collections::Generic::Dictionary<System::String ^, int> ^> m_gcGroupsDictionary;
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	void OpenFolder(KingOfCSharp::iHunter::IFolder ^ folder);

	void InitGroups();
	BOOL InsertMessageItem( KingOfCSharp::iHunter::IMessage ^ message, int i );
	void ShowSearchResult();
	void OpenInNewTab(int nItem);
	void Refresh();
private:
	CImageList m_imageList;
	BOOL m_bSearchResultMode;
protected:

	DECLARE_MESSAGE_MAP()

	afx_msg void OnMButtonDown(UINT nFlags,CPoint point);

	afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnLvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);
};


